package com.animee.jiujiangdict.collect_frag;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

public class CollectFragmentAdapter extends FragmentPagerAdapter {
    String[]titles ;   //滑动的标题
    List<Fragment> mDatas;
    public CollectFragmentAdapter(@NonNull FragmentManager fm,String[]titles,List<Fragment> mDatas) {
        super(fm);
        this.titles = titles;
        this.mDatas = mDatas;
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return mDatas.get(position);
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return titles[position];
    }
}
